import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 网关信息 */
export interface Gateways {
          id: number; // 编号
          buildingId?: number; // 楼栋id
          gateway?: string; // 网关
  }

// 网关 API
export const GatewaysApi = {
  // 查询网关分页
  getGatewaysPage: async (params: any) => {
    return await request.get({ url: `/dorm/gateways/page`, params })
  },

  // 查询网关详情
  getGateways: async (id: number) => {
    return await request.get({ url: `/dorm/gateways/get?id=` + id })
  },

  // 新增网关
  createGateways: async (data: Gateways) => {
    return await request.post({ url: `/dorm/gateways/create`, data })
  },

  // 修改网关
  updateGateways: async (data: Gateways) => {
    return await request.put({ url: `/dorm/gateways/update`, data })
  },

  // 删除网关
  deleteGateways: async (id: number) => {
    return await request.delete({ url: `/dorm/gateways/delete?id=` + id })
  },

  /** 批量删除网关 */
  deleteGatewaysList: async (ids: number[]) => {
    return await request.delete({ url: `/dorm/gateways/delete-list?ids=${ids.join(',')}` })
  },

  // 导出网关 Excel
  exportGateways: async (params) => {
    return await request.download({ url: `/dorm/gateways/export-excel`, params })
  },
}